<?php
namespace app\advice\model;

use think\Model;
use think\Db;

class AdviceModel extends Model
{
    public function addAdvice($advice)
    {
        $res = Db::name('advice')->insert($advice);
        return $res;
    }

    public function delAdvice($id)
    {
        $res = Db::name('advice')->where('advice_id', 'in', $id)->delete();
        return $res;
    }

    public function upAdvice($advice)
    {
        $res = Db::name('advice')->where('advice_id', $advice['advice_id'])->update($advice);
        return $res;
    }

    public function getAdvice($advice)
    {
        $res = Db::name('advice')->where($advice)->select();
        return $res;
    }
}
